package com.link2room.jetfire.entity;

import com.link2room.common.entity.BaseEntity;
import com.link2room.jetfire.constant.ReservationConstant;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by sss on 2017/4/19.
 */
@Entity
@Table(name = "reservation_account", schema = "ark_order_dev", catalog = "")
@DynamicInsert
public class ReservationAccount extends BaseEntity{
    private String l2RNo;
    private String pmsAccountNo;
    private BigDecimal resRateSumCost;
    private BigDecimal resRateRoomCost;
    private BigDecimal resRateExtraCost;
    private BigDecimal resRateSumSale;
    private BigDecimal resRateRoomSale;
    private BigDecimal resRateExtraSale;
    private BigDecimal resRatePromotionShow;
    private BigDecimal resRatePaySale;
    private BigDecimal resRateSumPms;
    private BigDecimal resRateRoomPms;
    private BigDecimal resRateExtraPms;
    private BigDecimal l2RPromotion;
    private BigDecimal hotelPromotion;
    private BigDecimal realRateSum;
    private BigDecimal realRateRoom;
    private BigDecimal realRateExtra;
    private BigDecimal deposit;
    private BigDecimal savepayMoney;
    private BigDecimal comm;
    private Date accountDate;
    /**
     * PMS支付状态:NONE未操作，DONE已操作，FAIL失败，REJECT撤销
     */
    private String pmsPaysta;
    /**
     * L2R支付状态:NONE未操作，DONE已操作，FAIL失败，REJECT撤销
     */
    private String l2rPaysta;
    private BigDecimal refund;
    /**
     * L2R支付状态:NONE无需退款，REFUNDING退款中，REFUSE拒绝,DONE成功;
     */
    private String refundSta;
    private String commCode;

    public void init(){
        setL2RPromotion(new BigDecimal(0));
        setResRateSumCost(new BigDecimal(0));
        setResRateRoomCost(new BigDecimal(0));
        setResRateExtraCost(new BigDecimal(0));
        setResRateSumSale(new BigDecimal(0));
        setResRateRoomSale(new BigDecimal(0));
        setResRateExtraSale(new BigDecimal(0));
        setResRatePaySale(new BigDecimal(0));
        setResRateSumPms(new BigDecimal(0));
        setResRateRoomPms(new BigDecimal(0));
        setResRateExtraPms(new BigDecimal(0));
        setResRatePromotionShow(new BigDecimal(0));
        setComm(new BigDecimal(1));
        setHotelPromotion(new BigDecimal(0));
        setRealRateSum(new BigDecimal(0));
        setRealRateRoom(new BigDecimal(0));
        setRealRateExtra(new BigDecimal(0));
        setDeposit(new BigDecimal(0));
        setSavepayMoney(new BigDecimal(0));
        setL2rPaysta(ReservationConstant.L2RPAYSTA.NONE);
        setPmsPaysta(ReservationConstant.PMSPAYSTA.NONE);
        setRefund(new BigDecimal(0));
    }

    @Basic
    @Column(name = "l2r_no", nullable = false, length = 32)
    public String getL2RNo() {
        return l2RNo;
    }

    public void setL2RNo(String l2RNo) {
        this.l2RNo = l2RNo;
    }

    @Basic
    @Column(name = "pms_account_no", nullable = true, length = 32)
    public String getPmsAccountNo() {
        return pmsAccountNo;
    }

    public void setPmsAccountNo(String pmsAccountNo) {
        this.pmsAccountNo = pmsAccountNo;
    }

    @Basic
    @Column(name = "res_rate_sum_cost", nullable = false, precision = 2)
    public BigDecimal getResRateSumCost() {
        return resRateSumCost;
    }

    public void setResRateSumCost(BigDecimal resRateSumCost) {
        this.resRateSumCost = resRateSumCost;
    }

    @Basic
    @Column(name = "res_rate_room_cost", nullable = false, precision = 2)
    public BigDecimal getResRateRoomCost() {
        return resRateRoomCost;
    }

    public void setResRateRoomCost(BigDecimal resRateRoomCost) {
        this.resRateRoomCost = resRateRoomCost;
    }

    @Basic
    @Column(name = "res_rate_extra_cost", nullable = false, precision = 2)
    public BigDecimal getResRateExtraCost() {
        return resRateExtraCost;
    }

    public void setResRateExtraCost(BigDecimal resRateExtraCost) {
        this.resRateExtraCost = resRateExtraCost;
    }

    @Basic
    @Column(name = "res_rate_sum_sale", nullable = false, precision = 2)
    public BigDecimal getResRateSumSale() {
        return resRateSumSale;
    }

    public void setResRateSumSale(BigDecimal resRateSumSale) {
        this.resRateSumSale = resRateSumSale;
    }


    @Basic
    @Column(name = "res_rate_room_sale", nullable = false, precision = 2)
    public BigDecimal getResRateRoomSale() {
        return resRateRoomSale;
    }

    public void setResRateRoomSale(BigDecimal resRateRoomSale) {
        this.resRateRoomSale = resRateRoomSale;
    }


    @Basic
    @Column(name = "res_rate_extra_sale", nullable = false, precision = 2)
    public BigDecimal getResRateExtraSale() {
        return resRateExtraSale;
    }

    public void setResRateExtraSale(BigDecimal resRateExtraSale) {
        this.resRateExtraSale = resRateExtraSale;
    }

    @Basic
    @Column(name = "res_rate_promotion_show", nullable = false, precision = 2)
    public BigDecimal getResRatePromotionShow() {
        return resRatePromotionShow;
    }

    public void setResRatePromotionShow(BigDecimal resRatePromotionShow) {
        this.resRatePromotionShow = resRatePromotionShow;
    }

    @Basic
    @Column(name = "res_rate_pay_sale", nullable = true, precision = 2)
    public BigDecimal getResRatePaySale() {
        return resRatePaySale;
    }

    public void setResRatePaySale(BigDecimal resRatePaySale) {
        this.resRatePaySale = resRatePaySale;
    }

    @Basic
    @Column(name = "res_rate_sum_pms", nullable = false, precision = 2)
    public BigDecimal getResRateSumPms() {
        return resRateSumPms;
    }

    public void setResRateSumPms(BigDecimal resRateSumPms) {
        this.resRateSumPms = resRateSumPms;
    }


    @Basic
    @Column(name = "res_rate_room_pms", nullable = false, precision = 2)
    public BigDecimal getResRateRoomPms() {
        return resRateRoomPms;
    }

    public void setResRateRoomPms(BigDecimal resRateRoomPms) {
        this.resRateRoomPms = resRateRoomPms;
    }

    @Basic
    @Column(name = "res_rate_extra_pms", nullable = false, precision = 2)
    public BigDecimal getResRateExtraPms() {
        return resRateExtraPms;
    }

    public void setResRateExtraPms(BigDecimal resRateExtraPms) {
        this.resRateExtraPms = resRateExtraPms;
    }

    @Basic
    @Column(name = "l2r_promotion", nullable = true, precision = 2)
    public BigDecimal getL2RPromotion() {
        return l2RPromotion;
    }

    public void setL2RPromotion(BigDecimal l2RPromotion) {
        this.l2RPromotion = l2RPromotion;
    }

    @Basic
    @Column(name = "hotel_promotion", nullable = true, precision = 2)
    public BigDecimal getHotelPromotion() {
        return hotelPromotion;
    }

    public void setHotelPromotion(BigDecimal hotelPromotion) {
        this.hotelPromotion = hotelPromotion;
    }

    @Basic
    @Column(name = "real_rate_sum", nullable = true, precision = 2)
    public BigDecimal getRealRateSum() {
        return realRateSum;
    }

    public void setRealRateSum(BigDecimal realRateSum) {
        this.realRateSum = realRateSum;
    }

    @Basic
    @Column(name = "real_rate_room", nullable = true, precision = 2)
    public BigDecimal getRealRateRoom() {
        return realRateRoom;
    }

    public void setRealRateRoom(BigDecimal realRateRoom) {
        this.realRateRoom = realRateRoom;
    }

    @Basic
    @Column(name = "real_rate_extra", nullable = true, precision = 2)
    public BigDecimal getRealRateExtra() {
        return realRateExtra;
    }

    public void setRealRateExtra(BigDecimal realRateExtra) {
        this.realRateExtra = realRateExtra;
    }

    @Basic
    @Column(name = "deposit", nullable = false, precision = 2)
    public BigDecimal getDeposit() {
        return deposit;
    }

    public void setDeposit(BigDecimal deposit) {
        this.deposit = deposit;
    }

    @Basic
    @Column(name = "refund", nullable = false, precision = 2)
    public BigDecimal getRefund() {
        return refund;
    }

    public void setRefund(BigDecimal refund) {
        this.refund = refund;
    }

    @Basic
    @Column(name = "savepay_money", nullable = false, precision = 2)
    public BigDecimal getSavepayMoney() {
        return savepayMoney;
    }

    public void setSavepayMoney(BigDecimal savepayMoney) {
        this.savepayMoney = savepayMoney;
    }

    @Basic
    @Column(name = "comm", nullable = false, precision = 2)
    public BigDecimal getComm() {
        return comm;
    }

    public void setComm(BigDecimal comm) {
        this.comm = comm;
    }

    @Basic
    @Column(name = "account_date", nullable = true)
    public Date getAccountDate() {
        return accountDate;
    }

    public void setAccountDate(Date accountDate) {
        this.accountDate = accountDate;
    }

    @Basic
    @Column(name = "pms_paysta", nullable = true, length = 10)
    public String getPmsPaysta() {
        return pmsPaysta;
    }

    public void setPmsPaysta(String pmsPaysta) {
        this.pmsPaysta = pmsPaysta;
    }

    @Basic
    @Column(name = "l2r_paysta", nullable = true, length = 10)
    public String getL2rPaysta() {
        return l2rPaysta;
    }

    public void setL2rPaysta(String l2rPaysta) {
        this.l2rPaysta = l2rPaysta;
    }

    @Basic
    @Column(name = "refund_sta", nullable = true, length = 10)
    public String getRefundSta() {
        return refundSta;
    }

    public void setRefundSta(String refundSta) {
        this.refundSta = refundSta;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ReservationAccount that = (ReservationAccount) o;

        if (l2RNo != null ? !l2RNo.equals(that.l2RNo) : that.l2RNo != null) return false;
        if (pmsAccountNo != null ? !pmsAccountNo.equals(that.pmsAccountNo) : that.pmsAccountNo != null) return false;
        if (resRateSumCost != null ? !resRateSumCost.equals(that.resRateSumCost) : that.resRateSumCost != null)
            return false;
        if (resRateRoomCost != null ? !resRateRoomCost.equals(that.resRateRoomCost) : that.resRateRoomCost != null)
            return false;
        if (resRateExtraCost != null ? !resRateExtraCost.equals(that.resRateExtraCost) : that.resRateExtraCost != null)
            return false;
        if (resRateSumSale != null ? !resRateSumSale.equals(that.resRateSumSale) : that.resRateSumSale != null)
            return false;
        if (resRateRoomSale != null ? !resRateRoomSale.equals(that.resRateRoomSale) : that.resRateRoomSale != null)
            return false;
        if (resRateExtraSale != null ? !resRateExtraSale.equals(that.resRateExtraSale) : that.resRateExtraSale != null)
            return false;
        if (resRatePaySale != null ? !resRatePaySale.equals(that.resRatePaySale) : that.resRatePaySale != null)
            return false;
        if (resRateSumPms != null ? !resRateSumPms.equals(that.resRateSumPms) : that.resRateSumPms != null)
            return false;
        if (resRateRoomPms != null ? !resRateRoomPms.equals(that.resRateRoomPms) : that.resRateRoomPms != null)
            return false;
        if (resRateExtraPms != null ? !resRateExtraPms.equals(that.resRateExtraPms) : that.resRateExtraPms != null)
            return false;
        if (l2RPromotion != null ? !l2RPromotion.equals(that.l2RPromotion) : that.l2RPromotion != null) return false;
        if (hotelPromotion != null ? !hotelPromotion.equals(that.hotelPromotion) : that.hotelPromotion != null)
            return false;
        if (realRateSum != null ? !realRateSum.equals(that.realRateSum) : that.realRateSum != null) return false;
        if (realRateRoom != null ? !realRateRoom.equals(that.realRateRoom) : that.realRateRoom != null) return false;
        if (realRateExtra != null ? !realRateExtra.equals(that.realRateExtra) : that.realRateExtra != null)
            return false;
        if (deposit != null ? !deposit.equals(that.deposit) : that.deposit != null) return false;
        if (comm != null ? !comm.equals(that.comm) : that.comm != null) return false;
        return accountDate != null ? accountDate.equals(that.accountDate) : that.accountDate == null;

    }

    @Override
    public int hashCode() {
        int result = l2RNo != null ? l2RNo.hashCode() : 0;
        result = 31 * result + (pmsAccountNo != null ? pmsAccountNo.hashCode() : 0);
        result = 31 * result + (resRateSumCost != null ? resRateSumCost.hashCode() : 0);
        result = 31 * result + (resRateRoomCost != null ? resRateRoomCost.hashCode() : 0);
        result = 31 * result + (resRateExtraCost != null ? resRateExtraCost.hashCode() : 0);
        result = 31 * result + (resRateSumSale != null ? resRateSumSale.hashCode() : 0);
        result = 31 * result + (resRateRoomSale != null ? resRateRoomSale.hashCode() : 0);
        result = 31 * result + (resRateExtraSale != null ? resRateExtraSale.hashCode() : 0);
        result = 31 * result + (resRatePaySale != null ? resRatePaySale.hashCode() : 0);
        result = 31 * result + (resRateSumPms != null ? resRateSumPms.hashCode() : 0);
        result = 31 * result + (resRateRoomPms != null ? resRateRoomPms.hashCode() : 0);
        result = 31 * result + (resRateExtraPms != null ? resRateExtraPms.hashCode() : 0);
        result = 31 * result + (l2RPromotion != null ? l2RPromotion.hashCode() : 0);
        result = 31 * result + (hotelPromotion != null ? hotelPromotion.hashCode() : 0);
        result = 31 * result + (realRateSum != null ? realRateSum.hashCode() : 0);
        result = 31 * result + (realRateRoom != null ? realRateRoom.hashCode() : 0);
        result = 31 * result + (realRateExtra != null ? realRateExtra.hashCode() : 0);
        result = 31 * result + (deposit != null ? deposit.hashCode() : 0);
        result = 31 * result + (comm != null ? comm.hashCode() : 0);
        result = 31 * result + (accountDate != null ? accountDate.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "comm_code", nullable = true, length = 32)
    public String getCommCode() {
        return commCode;
    }

    public void setCommCode(String commCode) {
        this.commCode = commCode;
    }

public enum ReservationAccount_{
    l2RNo
}
}
